package com.tnxst.phexamination.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.SavedStateViewModelFactory;
import androidx.lifecycle.ViewModelProvider;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.tnxst.phexamination.R;
import com.tnxst.phexamination.databinding.ActivityGoDoorRecordBinding;
import com.tnxst.phexamination.dto.TbPatientRecordDTO;
import com.tnxst.phexamination.utils.Utils;
import com.tnxst.phexamination.viewmodel.GlobalViewModel;

import java.util.List;

public class GoDoorRecordActivity extends BaseActivity implements View.OnClickListener{

    private GlobalViewModel viewModel;

    private ActivityGoDoorRecordBinding binding;

    private Context context;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        viewModel = new ViewModelProvider(this, new SavedStateViewModelFactory(getApplication(), this)).get(GlobalViewModel.class);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_go_door_record);
        binding.setGoDoorRecord(viewModel);
        binding.setLifecycleOwner(this);
        context = this;

        initView();
    }

    private void initView(){
        binding.cardView1.setOnClickListener(this);
        binding.cardView2.setOnClickListener(this);
        binding.cardView3.setOnClickListener(this);
        binding.cardView4.setOnClickListener(this);
        binding.cardView5.setOnClickListener(this);
        binding.cardView6.setOnClickListener(this);
        binding.cardView7.setOnClickListener(this);
        binding.cardView8.setOnClickListener(this);
        binding.cardView9.setOnClickListener(this);
        binding.cardView10.setOnClickListener(this);
        binding.cardView11.setOnClickListener(this);
        binding.cardView12.setOnClickListener(this);
        binding.cardView13.setOnClickListener(this);
        binding.cardView14.setOnClickListener(this);
        binding.cardView15.setOnClickListener(this);
        binding.imageView7.setOnClickListener(this);
        binding.imageView23.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        int id = v.getId();
        String name = "";
        Intent intent = new Intent(this,DoorRecordActivity.class);
        switch (id){
            case R.id.cardView1:


            case R.id.cardView2:


            case R.id.cardView3:


            case R.id.cardView4:


            case R.id.cardView5:


            case R.id.cardView6:


            case R.id.cardView7:


            case R.id.cardView8:


            case R.id.cardView9:
                Utils.Toast(context,"该功能尚未开放！");
                break;
            case R.id.cardView10:
                name = "高血压随访记录";
                intent.putExtra("name",name);
                startActivity(intent);
                break;
            case R.id.cardView11:
                name = "老年人中医管理记录";
                intent.putExtra("name",name);
                startActivity(intent);
                break;
            case R.id.cardView12:
                name = "糖尿病随访记录";
                intent.putExtra("name",name);
                startActivity(intent);
                break;
            case R.id.cardView13:
                name = "肺结核患者档案";
                intent.putExtra("name",name);
                startActivity(intent);
                break;
            case R.id.cardView14:
                name = "肺结核患者第一次入户随访记录";
                intent.putExtra("name",name);
                startActivity(intent);
                break;

            case R.id.cardView15:
                name = "肺结核患者随访记录";
                intent.putExtra("name",name);
                startActivity(intent);
                break;
            //返回
            case R.id.imageView7:
                finish();
                break;
            //添加
            case R.id.imageView23:
                Intent addDoorRecord = new Intent(this,AddDoorRecordActivity.class);
                startActivity(addDoorRecord);
                break;
        }

    }
}